package cn.cdiothree.controller;

import cn.cdiothree.domain.Result;
import cn.cdiothree.domain.auth.User;
import cn.cdiothree.service.impl.UserSerfviceImpl;
import cn.cdiothree.util.ResultUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户服务类
 * @author cumthing
 */
@RestController
@Api(value = "User API接口")
@RequestMapping("/api/v1/users")
public class UserController {
    @Autowired
    private UserSerfviceImpl userSerfviceImpl;

    /**
     * 查看用户列表
     * @param startPage
     * @param pageSize
     * @return
     */
    @GetMapping(value = "/")
    @ApiOperation(value = "列表", notes = "分页查询")
    public Result<Page<User>> listPage(@RequestParam("startPage") long startPage, @RequestParam("pageSize") long pageSize){
        Page<User> page=new Page<>(startPage,pageSize);
        Page<User> users= userSerfviceImpl.page(page);
        return ResultUtil.success(users);
    }
}
